<template>
	<view class="content">
		<view>
			<button type="default" open-type="getUserInfo" @getuserinfo="openLogin">获取微信信息，打开弹窗</button>
		</view>
		
		<u-popup :show="showLogin" @close="close">
			<view style="height: 200rpx;">
				111
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showLogin: false,
				wxcode: undefined,
			}
		},
		onLoad() {

		},
		methods: {
			openLogin(e) {
				this.showLogin = true
				const { encryptedData, iv } = e.detail;
				
				const loginRes = await uni.login({
					provider: "weixin"
				})
				console.log('login res:', loginRes)
				this.wxcode = loginRes.code
			},
			
			close() {
				this.showLogin = false
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
